import type { EditPatientParams, PatientAddReturnData, PatientListData, PostPatientAddParams } from '@/types/patient'
import { request } from '@/utils/request'

/**
 * 添加患者
 * @param data 患者姓名，身份证号，性别，是否为默认患者
 * @returns 返回患者id
 */
export const postPatientAddAPI = (data: PostPatientAddParams) => {
  return request<PatientAddReturnData>('/patient/add', 'POST', data)
}

/**
 * 获取患者列表
 * @returns 患者列表
 */
export const getPatientListAPI = ()=>{
  return request<PatientListData[]>('/patient/mylist','GET')
}

/**
 * 编辑患者
 * @param data 患者姓名，身份证号，性别，是否为默认患者，患者信息id
 * @returns 返回患者id
 */
export const editPatientAPI = (data:EditPatientParams)=>{
  return request('/patient/update','PUT',data)
}
/**
 * 获取患者详情
 */
export const getPatientInfoAPI = (id:string)=>{
  return request<EditPatientParams>(`/patient/info/${id}`)
}
/**
 * 删除患者
 */
export const delPatientAPI = (id:string)=>{
  return request (`/patient/del/${id}`,'DELETE')
}